home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / 11.02 Challenge / SolveTopEdgesFront-Right.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-10  |  2.8 KB  |  79 lines  |  [TEXT/KAHL]

  1. /*
  2.  
  3.     SolveRubiksCube
  4.     Copyright (c) 1994  J Robert Boonstra
  5.         
  6. */
  7.  
  8. #pragma options(honor_register,assign_registers)
  9.  
  10. #include "rubik.h"
  11. #include "transform.h"
  12.  
  13. void SolveTopEdgesFR(register RubiksCube *rub)
  14. {
  15.  
  16. /**********************************************************
  17.  * 
  18.  * STEP 1:  Put the edge cubes in the top layer into  
  19.  *          the proper position and orientation.  
  20.  *          Loop until all are correct.
  21.  *
  22.  *********************************************************/
  23.   if (UF_U == U && UF_F == F) {
  24.     /* leave edge in correct position */ ;
  25.   } else if (UF_U == F && UF_F == U) { F2D1R1F3R3;
  26.   } else if (UR_U == F && UR_R == U) { R3F3;
  27.   } else if (UB_U == F && UB_B == U) { B2D3R1F3R3;
  28.   } else if (UL_U == F && UL_L == U) { L1F1;
  29.   } else if (UR_U == U && UR_R == F) { R2D3F2;
  30.   } else if (UB_U == U && UB_B == F) { B2D2F2;
  31.   } else if (UL_U == U && UL_L == F) { L2D1F2;
  32.   } else if (RF_F == F && RF_R == U) { F3;
  33.   } else if (RB_R == F && RB_B == U) { B3D3B1R1F3R3;
  34.   } else if (LB_B == F && LB_L == U) { B1D2B3F2;
  35.   } else if (LF_L == F && LF_F == U) { L1D1L3F2;
  36.   } else if (RF_F == U && RF_R == F) { F1D1R1F3R3;
  37.   } else if (RB_R == U && RB_B == F) { R2F3R2;
  38.   } else if (LB_B == U && LB_L == F) { B1D3B3R1F3R3;
  39.   } else if (LF_L == U && LF_F == F) { F1;
  40.   } else if (DF_D == F && DF_F == U) { D1R1F3R3;
  41.   } else if (DR_D == F && DR_R == U) { R1F3R3;
  42.   } else if (DB_D == F && DB_B == U) { D3R1F3R3;
  43.   } else if (DL_D == F && DL_L == U) { L3F1L1;
  44.   } else if (DF_D == U && DF_F == F) { F2;
  45.   } else if (DR_D == U && DR_R == F) { D3F2;
  46.   } else if (DB_D == U && DB_B == F) { D2F2;
  47.   } else if (DL_D == U && DL_L == F) { D1F2;
  48.   }
  49. /*
  50.  * Find the top-right edge cube, and move it into the 
  51.  * proper position.
  52.  */
  53.   if (UR_U == U && UR_R == R) {
  54.     /* leave edge in correct position */ ;
  55.   } else if (UF_U == R && UF_F == U) { F1R1;
  56.   } else if (UR_U == R && UR_R == U) { R2D1B1R3B3;
  57.   } else if (UB_U == R && UB_B == U) { B3R3;
  58.   } else if (UL_U == R && UL_L == U) { L2D3B1R3B3;
  59.   } else if (UF_U == U && UF_F == R) { F2D1R2;
  60.   } else if (UB_U == U && UB_B == R) { B2D3R2;
  61.   } else if (UL_U == U && UL_L == R) { L2D2R2;
  62.   } else if (RF_F == R && RF_R == U) { F1D1F3R2;
  63.   } else if (RB_R == R && RB_B == U) { R3;
  64.   } else if (LB_B == R && LB_L == U) { L3D3L1B1R3B3;
  65.   } else if (LF_L == R && LF_F == U) { L1D2L3R2;
  66.   } else if (RF_F == U && RF_R == R) { R1;
  67.   } else if (RB_R == U && RB_B == R) { R1D1B1R3B3;
  68.   } else if (LB_B == U && LB_L == R) { B2R3B2;
  69.   } else if (LF_L == U && LF_F == R) { L1D3L3B1R3B3;
  70.   } else if (DF_D == R && DF_F == U) { F3R1F1;
  71.   } else if (DR_D == R && DR_R == U) { D1B1R3B3;
  72.   } else if (DB_D == R && DB_B == U) { B1R3B3;
  73.   } else if (DL_D == R && DL_L == U) { D3B1R3B3;
  74.   } else if (DF_D == U && DF_F == R) { D1R2;
  75.   } else if (DR_D == U && DR_R == R) { R2;
  76.   } else if (DB_D == U && DB_B == R) { D3R2;
  77.   } else if (DL_D == U && DL_L == R) { D2R2;
  78.   }
  79. }